package com.atguigu.a_collection;

import java.util.ArrayList;
import java.util.Collection;

public class Demo5 {
    public static void main(String[] args) {
        //创建集合对象
        Collection<String> col = new ArrayList<>();
        System.out.println("col = " + col);//[]

        //添加元素
        col.add("张三");
        col.add("李四");
        col.add("王五");
        System.out.println("col = " + col);//["张三","李四","王五"]

        //增强for循环遍历集合
        for (String name : col) {
            System.out.println("name = " + name);
        }
        System.out.println("--------------------");

        int[] arr = {1,2,3,4,5};
        for (int i : arr) {
            System.out.println("i = " + i);
        }

    }
}
